from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `admin_login_log` ADD `remark` VARCHAR(255) COMMENT '备注';
        ALTER TABLE `admin_login_log` DROP COLUMN `url`;
        ALTER TABLE `admin_login_log` DROP COLUMN `cost_time`;
        ALTER TABLE `admin_login_log` MODIFY COLUMN `user_id` INT COMMENT '用户 ID';
        ALTER TABLE `admin_login_log` MODIFY COLUMN `user_id` INT COMMENT '用户 ID';"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `admin_login_log` ADD `url` VARCHAR(255) NOT NULL COMMENT '请求地址';
        ALTER TABLE `admin_login_log` ADD `cost_time` DOUBLE COMMENT '耗时';
        ALTER TABLE `admin_login_log` DROP COLUMN `remark`;
        ALTER TABLE `admin_login_log` MODIFY COLUMN `user_id` INT NOT NULL;
        ALTER TABLE `admin_login_log` MODIFY COLUMN `user_id` INT NOT NULL;"""
